package com.bootdo.system.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import com.bootdo.system.util.FileUtil;

@Service("fileService")
public class FileService {
	@Autowired
	private FileUtil ossClient;
	
	  public String updateHead(MultipartFile file, long userId) throws Exception{
	    if (file == null || file.getSize() <= 0) {
	      throw new Exception("头像不能为空");
	    }
	    String name = ossClient.uploadImg2Oss(file);
	    String imgUrl = ossClient.getImgUrl(name);
	 //   userDao.updateHead(userId, imgUrl);//只是本地上传使用的
	    return imgUrl;
	  }

}
